package com.nineclock.system.service.impl;

import com.nineclock.common.enums.ResponseEnum;
import com.nineclock.common.exception.NcException;
import com.nineclock.system.mapper.SysFunctionMapper;
import com.nineclock.system.pojo.SysFunction;
import com.nineclock.system.service.SysFunctionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：zhouc
 * @date ：Created in 2021/6/24
 * @description ：
 * @version: 1.0
 */
@Service
public class SysFunctionServiceImpl implements SysFunctionService {
    
    @Autowired
    SysFunctionMapper functionMapper;
    @Override
    public List<SysFunction> findFunctionByUsername(String username,Long companyId1) throws Exception {
        if(StringUtils.isEmpty(username)){
            throw  new NcException(ResponseEnum.INVALID_PARAM_ERROR);
        }
        
        if((companyId1)== null){
            throw  new Exception(" 当前线程无效的请求参数");
        }
        List<SysFunction> functionList =  functionMapper.findFunctionByUsername(username,companyId1);
        
        return functionList;
    }
}
